/**
 * 处理复杂类型
 * @param {string} target 
 * @param {string} typeName 
 * @returns { boolean | string }
 */
const typeOf = (target, typeName = undefined) => {
  const text = Object.prototype.toString.apply(target);
  const type = /^\[object (\w+)]$/.exec(text)[1].toLocaleLowerCase();
  return typeName ? typeName === type : type
}

export default typeOf